<?php
/**
 * River item class.
 *
 * @package    Elgg.Core
 * @subpackage Core
 * 
 * @property int    $id            The unique identifier (read-only)
 * @property int    $subject_guid  The GUID of the actor
 * @property int    $object_guid   The GUID of the object
 * @property int    $annotation_id The ID of the annotation involved in the action
 * @property string $type          The type of one of the entities involved in the action
 * @property string $subtype       The subtype of one of the entities involved in the action
 * @property string $action_type   The name of the action
 * @property string $view          The view for displaying this river item
 * @property int    $access_id     The visibility of the river item
 * @property int    $posted        UNIX timestamp when the action occurred
 */
class ElggGolfCourseCardItem {
// 	'golf_course_card_id' 		=> ELGG_ENTITIES_ANY_VALUE,
// 	'golf_course_id'	      	=> ELGG_ENTITIES_ANY_VALUE,
// 	'hole'        				=> ELGG_ENTITIES_ANY_VALUE,
		
// 	''       	=> ELGG_ENTITIES_ANY_VALUE,
// 	''       	=> ELGG_ENTITIES_ANY_VALUE,
// 	''		=> ELGG_ENTITIES_ANY_VALUE,
// 	''	        => ELGG_ENTITIES_ANY_VALUE,
		
// 	''         				=> ELGG_ENTITIES_ANY_VALUE,
	
	
	public $golf_course_card_id;
	public $golf_course_id;
	public $hole;
	public $gold_tee_distance;
	public $blue_tee_distance;
	public $white_tee_distance;
	public $red_tee_distance;
	public $par;
	
	public $hole_x;
	public $hole_y;
	public $gold_tee_x;
	public $gold_tee_y;
	public $blue_tee_x;
	public $blue_tee_y;
	public $white_tee_x;
	public $white_tee_y;
	public $red_tee_x;
	public $red_tee_y;
	public $map;

	/**
	 * Construct a river item object given a database row.
	 *
	 * @param stdClass $object Object obtained from database
	 */
	function __construct($object) {
		if (!($object instanceof stdClass)) {
			// throw exception
		}
		
		// the casting is to support typed serialization like json
		$int_types = array('golf_course_card_id', 
				'golf_course_id', 'hole', 'gold_tee_distance', 'blue_tee_distance', 
				'white_tee_distance', 'red_tee_distance', 'par',
				'hole_x','hole_y','gold_tee_x','gold_tee_y','blue_tee_x','blue_tee_y','white_tee_x','white_tee_y','red_tee_x','red_tee_y');
		
		foreach ($object as $key => $value) {
			if (in_array($key, $int_types)) {
				$this->$key = (int)$value;
			} else {
				$this->$key = $value;
			}
		}
	}

}
